<template>
  <el-pagination
    class="mypage"
    background
    layout="total, sizes, prev, pager, next, jumper"
    :current-page="pagination.page"
    :page-size="pagination.pageSize"
    :total="pagination.total"
    :page-sizes="[10, 20, 50, 100]"
    @current-Change="currentChange"
    @size-change="sizeChange"
    :disabled="disabled"
  />
</template>

<script setup>
defineProps({
  pagination: {
    type: Object,
    required: true,
    default: () => {
      return {
        total: 0,
        page: 1,
        pageSize: 10
      };
    }
  },
  disabled: {
    type: Boolean,
    default: false
  }
});
const emit = defineEmits(['currentChange', 'sizeChange']);

function currentChange(page) {
  emit('currentChange', page);
}
function sizeChange(size) {
  emit('sizeChange', size);
}
</script>

<style lang="scss" scoped>
.mypage {
  justify-content: flex-end;
  margin-top: 10px;
}
</style>
